<?php
header('Content-Type:text/html; charset=utf-8');
session_start();
define('ENV', 0);//1真实环境0开发环境
if (!ENV){
	error_reporting(E_ALL);
}else{
	error_reporting(0);
}
define('DS', DIRECTORY_SEPARATOR);
define('ROOT_DIR', dirname(dirname(__FILE__)) . DS);
if (ENV){
	require_once ROOT_DIR . 'Include/Config.php';
}else{
	require_once ROOT_DIR . 'Include/ConfigTest.php';
}
define('APP_HOST', 'http://' . $_SERVER['HTTP_HOST'] . '/');

require_once ROOT_DIR . 'Libraries/Util.php';
require_once ROOT_DIR . 'Libraries/Mysql.php';
require_once ROOT_DIR . 'Include/Func.php';

define('COOKIE_EXPIRE', 86400);
define('CHARSET', 'UTF8');//编码
define('TPL_PATH', ROOT_DIR . 'Templates/');

//自动加载文件
function __autoload($classname)
{
	$findPath = array(
		ROOT_DIR . 'Libraries/' . $classname . '.php',
		ROOT_DIR . 'Controllers/' . APP_NAME . '/' . $classname . '.php',
		ROOT_DIR . 'Model/' . $classname . '.php',
	);
	
	foreach ($findPath as $filename){
		if (file_exists($filename)){
			require_once $filename;
			return true;
		}
	} 
	return false;
}